
<div id="contentAll" class="f-l">
	<form action="<?php echo base_url('panel/facturacion'); ?>" method="get" id="frmFiltrosCotiza" class="frmfiltros corner-all8 btn-gray">
		<label for="ffecha1">Fecha del:</label> 
		<input type="text" name="ffecha1" id="ffecha1" value="<?php echo $this->input->get('ffecha1'); ?>" size="10">
		
		<label for="ffecha2">Al:</label> 
		<input type="text" name="ffecha2" id="ffecha2" value="<?php echo $this->input->get('ffecha2'); ?>" size="10"> | 
		
		<label for="fserie">Serie</label>
		<select name="fserie" id="fserie">
			<option value=""></option>
	<?php foreach($series['series'] as $ser){ ?>
			<option value="<?php echo $ser->serie; ?>" <?php echo set_select_get('fserie', $ser->serie); ?>>
				<?php echo $ser->serie.($ser->leyenda!=''? '-'.$ser->leyenda: ''); ?></option>
	<?php }?>
		</select>
		
		<label for="ffolio">Folio:</label>
		<input type="text" name="ffolio" id="ffolio" value="<?php echo $this->input->get('ffolio'); ?>" size="10"> |
		
		<label for="fstatus">Status</label>
		<select name="fstatus" id="fstatus">
			<option value=""></option>
			<option value="p" <?php echo set_select_get('fstatus', 'p'); ?>>Pendientes</option>
			<option value="pa" <?php echo set_select_get('fstatus', 'pa'); ?>>Pagadas</option>
			<option value="ca" <?php echo set_select_get('fstatus', 'ca'); ?>>Canceladas</option>
		</select> 
		
		<br><label for="fcliente">Cliente:</label>
		<input type="text" name="fcliente" id="fcliente" value="<?php echo $this->input->get('fcliente'); ?>">
		<input type="hidden" name="fid_cliente" id="fid_cliente" value="<?php echo $this->input->get('fid_cliente'); ?>">
		
		<input type="submit" name="enviar" value="Enviar" class="btn-blue corner-all">
	</form>
	
	<table class="tblListados corner-all8">
		<tr class="header btn-gray">
			<td>Fecha</td>
			<td>Folio</td>
			<td>Cliente</td>
			<td>Total</td>
			<td>Status</td>
			<td class="a-c">Opc</td>
		</tr>
<?php foreach($fact['fact'] as $factu){
		$status = 'Pendiente';
		if($factu->status == 'pa')
			$status = 'Pagada';
		elseif($factu->status == 'ca')
			$status = 'Cancelada';
?>
		<tr>
			<td><?php echo $factu->fecha; ?></td>
			<td><?php echo ($factu->serie!=''? $factu->serie.'-': '').$factu->folio; ?></td>
			<td><?php echo $factu->nombre_fiscal; ?></td>
			<td><?php echo String::formatoNumero($factu->total); ?></td>
			<td><?php echo $status; ?></td>
			<td class="tdsmenu a-c" style="width: 90px;">
				<img alt="opc" src="<?php echo base_url('application/images/privilegios/gear.png'); ?>" width="16" height="16">
				<div class="submenul">
					<p class="corner-bottom8">
						<?php 
						echo $this->empleados_model->getLinkPrivSm('facturacion/ver/', $factu->id_factura, '', '');
						echo '<a href="'.base_url('panel/facturacion/imprimir/?id='.$factu->id_factura).'" class="linksm" target="_blank">
						<img src="'.base_url('application/images/privilegios/pdf.png').'" width="10" height="10"> Imprimir</a><br>';
						
						if($factu->status == 'p')
							echo $this->empleados_model->getLinkPrivSm('facturacion/pagar/', $factu->id_factura, '', ' rel="superbox[iframe][800x500]"');
						
						if($factu->status != 'ca')
							echo $this->empleados_model->getLinkPrivSm('facturacion/cancelar/', $factu->id_factura, 
								"cancelarF(this); return false;");

						echo $this->empleados_model->getLinkPrivSm('facturacion/enviar/', $factu->id_factura, '', '');
						?>
					</p>
				</div>
			</td>
		</tr>
<?php }?>
	</table>
<?php
//Paginacion
$this->pagination->initialize(array(
		'base_url' 			=> base_url($this->uri->uri_string()).'?'.String::getVarsLink(array('pag')).'&',
		'total_rows'		=> $fact['total_rows'],
		'per_page'			=> $fact['items_per_page'],
		'cur_page'			=> $fact['result_page']*$fact['items_per_page'],
		'page_query_string'	=> TRUE,
		'num_links'			=> 1,
		'anchor_class'		=> 'pags corner-all'
));
$pagination = $this->pagination->create_links();
echo '<div class="pagination w100">'.$pagination.'</div>'; 
?>
</div>

<!-- Bloque de alertas -->
<?php if(isset($frm_errors)){
	if($frm_errors['msg'] != ''){ 
?>
<div id="container" style="display:none">
	<div id="withIcon">
		<a class="ui-notify-close ui-notify-cross" href="#">x</a>
		<div style="float:left;margin:0 10px 0 0"><img src="#{icon}" alt="warning" width="64" height="64"></div>
		<h1>#{title}</h1>
		<p>#{text}</p>
		<div class="clear"></div>
	</div>
</div>
<script type="text/javascript" charset="UTF-8">
$(function(){
	create("withIcon", {
		title: '<?php echo $frm_errors['title']; ?>', 
		text: '<?php echo $frm_errors['msg']; ?>', 
		icon: '<?php echo base_url('application/images/alertas/'.$frm_errors['ico'].'.png'); ?>' });
});
</script>
<?php }
}?>
<!-- Bloque de alertas -->
